#define _CRT_SECURE_NO_WARNINGS 1

int findPeakElement(int* nums, int numsLen) {
    // write code here
    int i = 0;
    while (nums[i] < nums[i + 1]) {
        ++i;
        if (i == numsLen - 1) return numsLen - 1;
    }
    return i;
}